package com.zxq.protocol.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 协议指令码
 * @TableName iot_protocol_data_cmd
 */
@TableName(value ="iot_protocol_data_cmd")
@Data
public class IotProtocolDataCmdDo implements Serializable {
    /**
     * 主键id
     */
    @TableId
    private Long id;

    /**
     * 指令码
     */
    private Integer cmdCode;

    /**
     * 平台下发0，回复平台1，上报2，上报回复3
     */
    private Integer cmdType;

    /**
     * json对应的key值
     */
    private String jsonField;

    /**
     * 字段类型
     */
    private Long jsonFieldType;

    /**
     * 字段长度
     */
    private Integer jsonFieldParam;

    /**
     * json字段，报文中的默认排序
     */
    private Integer jsonFieldIndex;

    /**
     * 二进制长度截取方式 
0长度 1直到某个字符 2倒数
     */
    private Long blockTrimType;

    /**
     * 截获数据的参数
     */
    private Integer blockTrimParam;

    /**
     * 数据大小端
     */
    private Integer blockBigEndian;

    /**
     * 父指令，用于解析指令的嵌套，没有的填-1
     */
    private Long parentId;

    /**
     * 数据协议数据id
     */
    private Long protocolId;

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 创建时间
     */
    private Date createDate;

    /**
     * 更新者
     */
    private Long updater;

    /**
     * 更新时间
     */
    private Date updateDate;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        IotProtocolDataCmdDo other = (IotProtocolDataCmdDo) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCmdCode() == null ? other.getCmdCode() == null : this.getCmdCode().equals(other.getCmdCode()))
            && (this.getCmdType() == null ? other.getCmdType() == null : this.getCmdType().equals(other.getCmdType()))
            && (this.getJsonField() == null ? other.getJsonField() == null : this.getJsonField().equals(other.getJsonField()))
            && (this.getJsonFieldType() == null ? other.getJsonFieldType() == null : this.getJsonFieldType().equals(other.getJsonFieldType()))
            && (this.getJsonFieldParam() == null ? other.getJsonFieldParam() == null : this.getJsonFieldParam().equals(other.getJsonFieldParam()))
            && (this.getJsonFieldIndex() == null ? other.getJsonFieldIndex() == null : this.getJsonFieldIndex().equals(other.getJsonFieldIndex()))
            && (this.getBlockTrimType() == null ? other.getBlockTrimType() == null : this.getBlockTrimType().equals(other.getBlockTrimType()))
            && (this.getBlockTrimParam() == null ? other.getBlockTrimParam() == null : this.getBlockTrimParam().equals(other.getBlockTrimParam()))
            && (this.getBlockBigEndian() == null ? other.getBlockBigEndian() == null : this.getBlockBigEndian().equals(other.getBlockBigEndian()))
            && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId()))
            && (this.getProtocolId() == null ? other.getProtocolId() == null : this.getProtocolId().equals(other.getProtocolId()))
            && (this.getCreator() == null ? other.getCreator() == null : this.getCreator().equals(other.getCreator()))
            && (this.getCreateDate() == null ? other.getCreateDate() == null : this.getCreateDate().equals(other.getCreateDate()))
            && (this.getUpdater() == null ? other.getUpdater() == null : this.getUpdater().equals(other.getUpdater()))
            && (this.getUpdateDate() == null ? other.getUpdateDate() == null : this.getUpdateDate().equals(other.getUpdateDate()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCmdCode() == null) ? 0 : getCmdCode().hashCode());
        result = prime * result + ((getCmdType() == null) ? 0 : getCmdType().hashCode());
        result = prime * result + ((getJsonField() == null) ? 0 : getJsonField().hashCode());
        result = prime * result + ((getJsonFieldType() == null) ? 0 : getJsonFieldType().hashCode());
        result = prime * result + ((getJsonFieldParam() == null) ? 0 : getJsonFieldParam().hashCode());
        result = prime * result + ((getJsonFieldIndex() == null) ? 0 : getJsonFieldIndex().hashCode());
        result = prime * result + ((getBlockTrimType() == null) ? 0 : getBlockTrimType().hashCode());
        result = prime * result + ((getBlockTrimParam() == null) ? 0 : getBlockTrimParam().hashCode());
        result = prime * result + ((getBlockBigEndian() == null) ? 0 : getBlockBigEndian().hashCode());
        result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode());
        result = prime * result + ((getProtocolId() == null) ? 0 : getProtocolId().hashCode());
        result = prime * result + ((getCreator() == null) ? 0 : getCreator().hashCode());
        result = prime * result + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode());
        result = prime * result + ((getUpdater() == null) ? 0 : getUpdater().hashCode());
        result = prime * result + ((getUpdateDate() == null) ? 0 : getUpdateDate().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", cmdCode=").append(cmdCode);
        sb.append(", cmdType=").append(cmdType);
        sb.append(", jsonField=").append(jsonField);
        sb.append(", jsonFieldType=").append(jsonFieldType);
        sb.append(", jsonFieldParam=").append(jsonFieldParam);
        sb.append(", jsonFieldIndex=").append(jsonFieldIndex);
        sb.append(", blockTrimType=").append(blockTrimType);
        sb.append(", blockTrimParam=").append(blockTrimParam);
        sb.append(", blockBigEndian=").append(blockBigEndian);
        sb.append(", parentId=").append(parentId);
        sb.append(", protocolId=").append(protocolId);
        sb.append(", creator=").append(creator);
        sb.append(", createDate=").append(createDate);
        sb.append(", updater=").append(updater);
        sb.append(", updateDate=").append(updateDate);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}